/**
 * 
 */
package com.hp.bon.sgw.bean;

import java.util.HashSet;
import java.util.LinkedList;

import com.hp.ocs.diameter.message.dictionary.AvpType;

public class BlacklistRuleView {
	private Long id;
	private String hostId;
	private String serviceContextId;
	private String keyXmlTag;
	private String rule;
	
	private Long blackCycle;
	private Long blackNum;
	private String appName;
	
	private LinkedList<AvpType> keyAvpPath = new LinkedList<AvpType>();
	private HashSet<Integer> rcMap = new HashSet<Integer>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getHostId() {
		return hostId;
	}

	public void setHostId(String hostId) {
		this.hostId = hostId;
	}

	public String getServiceContextId() {
		return serviceContextId;
	}

	public void setServiceContextId(String serviceContextId) {
		this.serviceContextId = serviceContextId;
	}

	public String getRule() {
		return rule;
	}

	public void setRule(String rule) {
		this.rule = rule;
	}

	public String getKeyXmlTag() {
		return keyXmlTag;
	}

	public void setKeyXmlTag(String keyXmlTag) {
		this.keyXmlTag = keyXmlTag;
	}
	
	public Long getBlackCycle() {
		return blackCycle;
	}

	public void setBlackCycle(Long blackCycle) {
		this.blackCycle = blackCycle;
	}

	public Long getBlackNum() {
		return blackNum;
	}

	public void setBlackNum(Long blackNum) {
		this.blackNum = blackNum;
	}
	
	public String getAppName() {
		return appName;
	}
	
	public void setAppName(String appName) {
		this.appName = appName;
	}

	public LinkedList<AvpType> getKeyAvpPath() {
		return keyAvpPath;
	}

	public void setKeyAvpPath(LinkedList<AvpType> keyAvpPath) {
		this.keyAvpPath = keyAvpPath;
	}

	public HashSet<Integer> getRcMap() {
		if (rule != null) {
			String[] rc = rule.split("\\|");
			if (rc != null) {
				for (int i = 0; i < rc.length; i++) {
					rcMap.add(Integer.valueOf(rc[i]));
				}
			}
		}
		return rcMap;
	}

	public void setRcMap(HashSet<Integer> rcMap) {
		this.rcMap = rcMap;
	}

	public String getKey(){
		return String.format("<%s><%s>", this.hostId, this.serviceContextId);
	}
}
